<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Amaze UI Admin index Examples</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <link rel="icon" type="image/png" href="__ADMIN__/i/favicon.png">
    <link rel="stylesheet" href="__ADMIN__/css/amazeui.min.css" />
    <link rel="stylesheet" href="__ADMIN__/css/app.css">
    <script src="__ADMIN__/js/jquery.min.js"></script>

</head>

<body data-type="index">
<script src="__ADMIN__/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 头部 -->
    <header>
        <!-- logo -->
        <div class="am-fl tpl-header-logo">
            <a href="javascript:;"><img src="__ADMIN__/img/logo.png" alt=""></a>
        </div>
        <!-- 右侧内容 -->
        <div class="tpl-header-fluid">
            <!-- 侧边切换 -->
            <div class="am-fl tpl-header-switch-button am-icon-list">
                    <span>

                </span>
            </div>

            <div class="am-fl tpl-header-navbar">
                <ul id="nav">
                    <li class="am-text-sm"><a href="javascript:;"><span class="am-icon-sign-out"></span>首页</a></li>
                </ul>
            </div>
            <!-- 其它功能-->
            <div class="am-fr tpl-header-navbar">
                <ul>
                    <!-- 退出 -->
                    <li class="am-text-sm">
                        <a href="javascript:;">
                            <span class="am-icon-sign-out"></span> 退出
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </header>
    <!-- 风格切换 -->
    <div class="tpl-skiner">
        <div class="tpl-skiner-toggle am-icon-cog">
        </div>
        <div class="tpl-skiner-content">
            <div class="tpl-skiner-content-title">
                选择主题
            </div>
            <div class="tpl-skiner-content-bar">
                <span class="skiner-color skiner-white" data-color="theme-white"></span>
                <span class="skiner-color skiner-black" data-color="theme-black"></span>
            </div>
        </div>
    </div>
    <!-- 侧边导航栏 -->
    <div class="left-sidebar">
        <!-- 菜单 -->
        <ul class="sidebar-nav" id="menu">
            <li class="sidebar-nav-link"><a href="index.html" class="active"><i class="am-icon-home sidebar-nav-link-logo"></i> 首页</a></li>
            <li class="sidebar-nav-link">
                <a href="tables.html">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 表格
                </a>
            </li>
        </ul>
    </div>

    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <iframe id="kb-iframe" name="kb-iframe" width="100%" height=100%  marginheight="0" marginwidth="0" frameborder="0" scrolling="no"  class="kb-iframe" name="iframepage"  onLoad="iFrameHeight()" src="" frameborder="0"></iframe>
    </div>
</div>
</div>
<script src="__ADMIN__/js/amazeui.min.js"></script>
<script src="__ADMIN__/js/app.js"></script>
<script>
    //生成主菜单
    var data = {$menuList};
    var topNav = '';
    for(var i in data){
        if(data[i]['menu'] != ''){
            topNav += '<li class="am-text-sm"><a href="javascript:;" data="'+i+'" url=""> <span class="am-icon-'+data[i].icon+'"></span> '+data[i].name+'</a></li>';
        }
    }
    $('#nav').html(topNav);
    //绑定导航连接
    $('#nav').on('click','a',function(){
        $('#nav-head').text($(this).text());
        var n = $(this).attr('data');
        var menu = data[n]['menu'];
        var menuHtml =  '';
        if(menu != ''){
            for(var i in menu){
                menuHtml += '<li class="sidebar-nav-link"><a href="javascript:;" url="'+menu[i].url+'" class="icon-'+menu[i].icon+'"> <i class="am-icon-'+menu[i].icon+' sidebar-nav-link-logo"></i>'+menu[i].name+'</a></li>';
            }
        }
        $('#menu').html(menuHtml);
        //设置样式
        $('#nav li a').removeClass('active');
        $(this).addClass('active');
        //打开菜单
        $('#menu a:first').click();
    });
    //绑定菜单连接
    $('#menu').on('click','a',function(){
        var url = $(this).attr('url');
        $('.kb-iframe').attr('src',url);
        //设置样式
        $('#menu li a').removeClass('active');
        $(this).addClass('active');
    });
    $('#nav a:first').click();
</script>
<script type="text/javascript" language="javascript">
    function iFrameHeight() {
        var ifm= document.getElementById("kb-iframe");
        var subWeb = document.frames ? document.frames["kb-iframe"].document :
                ifm.contentDocument;
        if(ifm != null && subWeb != null) {
            ifm.height = subWeb.body.scrollHeight;
        }
    }
</script>
</body>
</html>